package com.example.administrator.myapplication;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

public class MainActivity extends AppCompatActivity {
    private Button firstCPBnt;
    private Button readContactBnt;
    private Button manageContectBnt;
    private Button manageMediaBnt;
    private Button manageContactBnt;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        firstCPBnt = (Button) findViewById(R.id.firstCPBnt);
        firstCPBnt.setOnClickListener(onClickListening);
        readContactBnt = (Button) findViewById(R.id.readContactBnt);
        readContactBnt.setOnClickListener(onClickListening);
        manageContactBnt = (Button) findViewById(R.id.manageContactBnt);
        manageContactBnt.setOnClickListener(onClickListening);
        manageMediaBnt = (Button) findViewById(R.id.manageMediaBnt);
        manageMediaBnt.setOnClickListener(onClickListening);
    }
    private View.OnClickListener onClickListening =
            new View.OnClickListener() {
                public void onClick(View view) {
                    Intent intent = new Intent();
                    switch (view.getId()) {
                        case R.id.firstCPBnt:
                            intent.setClass(MainActivity.this, FirstProviderActivity.class);
                            startActivity(intent);
                            break;
                        case R.id.readContactBnt:
                            intent.setClass(MainActivity.this, ReadContectActivity.class);
                            startActivity(intent);
                            break;
                        case R.id.manageContactBnt:
                            intent.setClass(MainActivity.this, ManageContectActivity.class);
                            startActivity(intent);
                            break;
                        case R.id.manageMediaBnt:
                            intent.setClass(MainActivity.this, ManageMediaActivity.class);
                            startActivity(intent); break;
                    }
                }
            };
}
